/*
 * glapp.c
 * framework of OpenGL application
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "vgl.h"
#include "glapp.h"


/*=============================================================================
**  local variable
**===========================================================================*/

/*=============================================================================
**  functions implement
**===========================================================================*/

/* get tick timestamp */
unsigned int gljosTickGet()
{
#if defined(WIN32)
	return GetTickCount();
#elif defined(__VXWORKS__)
	return tickGet();
#elif defined(__linux__)
	struct timeval tv;
	/* Return the time of day in milliseconds. */
	gettimeofday(&tv, 0);
	return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
#else
#error gljosTickGet() NOT implemented!
#endif
}
/* get ticks per second */
unsigned int gljosClkRateGet()
{
	return 1000;
}
void gljosTaskDelay(int ticks)
{
#if defined(WIN32)
	Sleep(ticks);
#else
	taskDelay(ticks);
#endif
}
